﻿using System;
using System.Collections.Generic;

namespace CodeGenerator.interfaces
{
    public abstract class MultipleTargetObject
    {
        private Dictionary<OutputType, string> _sourceCode = new Dictionary<OutputType, string>();
        public string GetSourceCode(OutputType OutputType)
        {
            string res;
            if (_sourceCode.TryGetValue(OutputType, out res))
                return res;
            throw new InvalidOperationException("Code for " + OutputType.ToString() + " not found!");
        }

        public void SetSourceCode(OutputType OutputType, string SourceCode)
        {
            if (_sourceCode.ContainsKey(OutputType))
            {
                _sourceCode.Remove(OutputType);

            }
            _sourceCode.Add(OutputType, SourceCode);
        }
    }
}